package com.SmartClassroom.system.common;

import com.SmartClassroom.system.exception.BusinessException;
import com.SmartClassroom.system.model.domain.Attendance;
import com.SmartClassroom.system.model.domain.Course;
import com.SmartClassroom.system.model.dto.attendance.AttendanceUpdateRequest;

public class CourseUtil {

    public static void setCourseId(Course course, String courseName) {
        switch (courseName) {
            case "高等数学":
                course.setCourseId(1);
                break;
            case "大学英语":
                course.setCourseId(2);
                break;
            case "线性代数":
                course.setCourseId(3);
                break;
            case "离散数学":
                course.setCourseId(4);
                break;
            case "Java编程":
                course.setCourseId(5);
                break;
            case "网络安全":
                course.setCourseId(6);
                break;
            case "SDN网络编程编程":
                course.setCourseId(7);
                break;
            case "物理":
                course.setCourseId(8);
                break;
            default:
                throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "无效的课程: " + courseName + "请联系管理员");
        }
    }
public static void setAttendanceId(Attendance attendance, String courseName) {
        switch (courseName) {
            case "高数":
                attendance.setCourseId(1);
                break;
            case "大学英语":
                attendance.setCourseId(2);
                break;
            case "线性代数":
                attendance.setCourseId(3);
                break;
            case "离散数学":
                attendance.setCourseId(4);
                break;
            case "Java编程":
                attendance.setCourseId(5);
                break;
            case "网络安全":
                attendance.setCourseId(6);
                break;
            case "SDN网络编程编程":
                attendance.setCourseId(7);
                break;
            case "物理":
                attendance.setCourseId(8);
                break;
            default:
                throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "无效的课程: " + courseName + "请联系管理员");
        }
    }

    public static void setDayOfWeek(Course course, String dayOfWeek) {
        switch (dayOfWeek) {
            case "星期一":
                course.setDayOfWeek("Monday");
                break;
            case "星期二":
                course.setDayOfWeek("Tuesday");
                break;
            case "星期三":
                course.setDayOfWeek("Wednesday");
                break;
            case "星期四":
                course.setDayOfWeek("Thursday");
                break;
            case "星期五":
                course.setDayOfWeek("Friday");
                break;
            case "星期六":
                course.setDayOfWeek("Saturday");
                break;
            case "星期日":
                course.setDayOfWeek("Sunday");
                break;
            default:
                throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "无效的星期几: " + dayOfWeek);
        }
    }
}
